<template>
<el-container>
  <el-header>
    <el-col span="24">
      <el-input v-model="docAddRequest.docTitle" placeholder="请输入智库DOC标题"></el-input>
    </el-col>
  </el-header>
  <el-main style="height: 100%">
    <el-col span="17">
      <editor-box></editor-box>
    </el-col>
    <el-col span="6" style="border: ridge 1px; margin-left: 3px;height: 11vh">
      <doc-aside-box></doc-aside-box>
      <el-button @click="publish" type="primary">
        发布
      </el-button>
    </el-col>
  </el-main>
</el-container>
</template>

<script>
import docAsideBox from "@/components/docComponents/docAsideBox";
import EditorBox from "@/components/Editor/editorBox";
import {DocAddRequest} from "@/entity/doc/DocAddRequestBody";
import {ttAPI} from "@/api/ttApi";
export default {
  name: "ariticlePublishPage",
  components: {EditorBox, docAsideBox},
  data() {
    return {
      docAddRequest: new DocAddRequest()
    }
  },
  methods:{
    async publish() {
      this.docAddRequest.labelList = JSON.stringify(this.docAddRequest.labelList)
      await this.axios.post(ttAPI.adddocs, this.docAddRequest)
          .then(res => {
            if (!res.data.code) {
              this.$message.success(res.data.message)
            } else {
              this.$message.error(res.data.message)
            }
            this.docAddRequest.labelList=JSON.parse(this.docAddRequest.labelList)
          })
          .catch(err => {
            this.$message.info(err.data.message)
          })

    }
  }
}
</script>

<style scoped>

</style>